package com.cy.pj.goods.dao;

import com.cy.pj.goods.pojo.Goods;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface GoodsDao {

    @Insert("insert into tb_goods (name,remark,createdTime) Values(#{name},#{remark},now())")
    void insertGoods(Goods goods);

    @Update("update tb_goods set name=#{name},remark=#{remark} where id=#{id}")
    void updateGoods(Goods goods);

    @Select("select * from tb_goods where id=#{id}")
    List<Goods> findGoodsById(Integer id);

    @Delete("delete from tb_goods where id=#{id}")
    public void deleteGoodsById(Integer id);

    //简单sql语句，直接使用注解来进行定义，复杂sql语句，在xml文件中进行定义
    @Select("select * from tb_goods")
    List<Goods> findGoods();
}
